In [1]:
import pandas as pd
from matplotlib import pyplot as plt
#import plotly.express as px
wf_abridged = pd.read_csv('abridged.csv', low_memory = False)
CA_data = wf_abridged[wf_abridged.state.isin(['CA'])]
TX_data = wf_abridged[wf_abridged.state.isin(['TX'])]
CO_data = wf_abridged[wf_abridged.state.isin(['CO'])]
wf_abridged = wf_abridged.drop('Unnamed: 0', axis=1)
In [2]:
import seaborn as sns
import statistics
x = wf_abridged.stat_cause_descr
y = wf_abridged.fire_size
norm = []

maximum = max(wf_abridged.loc[:,'fire_size'])
minimum = min(wf_abridged.loc[:,'fire_size'])
In [3]:
for i in range(0, len(wf_abridged)):
    norm.append((wf_abridged.loc[i,'fire_size'] - minimum)/(maximum - minimum))

plt.figure(figsize=(7,7,))

ax = sns.boxplot(x=x, y=norm, data=wf_abridged)
ax.set_xticklabels(ax.get_xticklabels(), rotation=45)
ax.set(ylabel = 'fire size (acres)')
plt.savefig('causes.png', bbox_inches = 'tight')
plt.show()
In [4]:
import pandas as pd
import plotly.express as px
import matplotlib.pyplot as plt

wf = pd.read_csv('/Users/michaelmccauley/Downloads/abridged.csv')


fig = px.scatter_mapbox(wf, lat="lat", lon="long", hover_name="state", hover_data=["fire_year","fips_name", "fire_size"],
                        color_discrete_sequence=["orange"], zoom=3, height=300)
fig.update_layout(mapbox_style="open-street-map")
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()
In [5]:
wf["TimeBins"] = pd.cut(x=wf["discovery_time"], bins=[0,600,1200,1700,2000,2400],
                         labels=["Night2", "Morning", "Afternoon","Evening","Night1"])
In [6]:
a = wf[wf['state'] == 'CA']
b = wf[wf['state'] == 'TX']
c = wf[wf['state'] == 'CO']
d = a['discovery_month'].value_counts().sort_index()
e = b['discovery_month'].value_counts().sort_index()
f = c['discovery_month'].value_counts().sort_index()
ind = [1,2,3,4,5,6,7,8,9,10,11,12]
df = pd.DataFrame({
    'CA': d,
    'TX': e,
    'CO': f
    }, index=ind)
lines = df.plot.line(title='Frequencies of Wildfire in Months by States')
In [7]:
import numpy as np
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
data = wf["discovery_time"]
bins=[0,600,1200,1700,2000,2400]
N, bins, patches = ax.hist(data,bins,edgecolor='white', linewidth=1)

plt.ylabel('Count of Wildfire Occurance')
plt.xlabel('Time of Day')
plt.title('Counts of Wildfire Occurence at Different Times of a Day')
names=["Night2", "Morning", "Afternoon","Evening","Night1"]
ax.set_xticks(bins)
#ax.set_xticklabels(names,rotation=0, rotation_mode="anchor", ha="left")
plt.show()
In [ ]: